<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge, chrome=1" />
    <meta name="renderer" content="webkit" />
    <meta name="format-detection" content="telephone=no" />
    <title>业务管理系统-系统管理-数据权限</title>
    <meta name="description" content="" />
    <meta name="keywords" content="" />
    <link rel="stylesheet" href="/css/style.css" />
    <link rel="stylesheet" href="/css/iconfont.css" />
    <link rel="stylesheet" href="/css/element-icons.css" />
    <link rel="stylesheet" href="/css/newiconfont.css" />
    <script src="/js/jquery.min.js"></script>
    <script src="/js/lib.js"></script>
    <!--[if lt IE 9]>
    <script src="https://cdn.bootcss.com/html5shiv/r29/html5.min.js"></script>
    <script src="https://cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
    <!--[if IE]>
    <link rel="stylesheet" href="/css/all-ie-only.css" />
    <![endif]-->
</head>

<body>
<div class="header">
    <a href="javascript:;" class="header-logo">
        <img src="/images/logo.png" alt="" />
    </a>
    <div class="header-nav">
        <ul class="fix">
            <li>
                <a href="javascript:;" class="v1">标识注册系统</a>
            </li>
            <li>
                <a href="javascript:;" class="v1">标识解析系统</a>
            </li>
            <li>
                <a href="javascript:;" class="v1">统一认证系统</a>
            </li>
            <li>
                <a href="javascript:;" class="v1">运行检测系统</a>
            </li>
            <li>
                <a href="javascript:;" class="v1">区块链浏览器</a>
            </li>
            <li>
                <a href="javascript:;" class="v1">链网展示系统</a>
            </li>
        </ul>
    </div>
    <div class="header-user">
        <a href="javascript:;" class="hd">
            <img src="/images/head.png" alt="" />
            <span>管理员</span>
        </a>
        <div class="dropdown-menu">
            <div class="icon-arrow"></div>
            <ul>
                <li class="wrz">
                    <a href="javascript:;" class="con">
                        <span>未认证</span>
                    </a>
                </li>
                <li>
                    <a href="javascript:;" class="con">
                        <span>首页</span>
                    </a>
                </li>
                <li>
                    <a href="javascript:;" class="con">
                        <span>资料编辑</span>
                    </a>
                </li>
                <li>
                    <a href="javascript:;" class="con">
                        <span>我的钱包</span>
                    </a>
                </li>
                <li>
                    <a onclick="logout()" class="con">
                        <span>退出</span>
                    </a>
                </li>
            </ul>
        </div>
    </div>
</div>
<div class="block-contail">
    <!-- 布局-侧边 -->
    <div class="block-left">
        <div class="block-scrollbar">
            <!-- 收起、展开按钮 -->
            <div class="arrow-btn">
                <span class="el-icon-arrow-left"></span>
            </div>
            <!-- 收起、展开按钮 end -->
            <!-- 侧边导航 -->
            <ul class="slide-nav">
                <li>
                    <a href="javascript:;" class="v1">
                        <i class="icon_dn icon newiconfont newicon1-guganlianguanli"></i>
                        <span class="title">骨干链管理</span>
                        <i class="icon-arrow el-icon-arrow-down"></i>
                    </a>
                    <div class="slide-nav-subitem">
                        <ul>
                            <li>
                                <a href="javascript:;" class="v2">
                                    <span class="title">基础配置</span>
                                </a>
                            </li>
                            <li>
                                <a href="javascript:;" class="v2">
                                    <span class="title">节点管理</span>
                                </a>
                            </li>
                            <li>
                                <a href="javascript:;" class="v2">
                                    <span class="title">合约管理</span>
                                </a>
                            </li>
                            <li>
                                <a href="javascript:;" class="v2">
                                    <span class="title">用户管理</span>
                                </a>
                            </li>
                        </ul>
                    </div>
                </li>
                <li>
                    <a href="javascript:;" class="v1">
                        <i class="icon_dn icon newiconfont newicon2-zilianguanli"></i>
                        <span class="title">子链管理</span>
                        <i class="icon-arrow el-icon-arrow-down"></i>
                    </a>
                    <div class="slide-nav-subitem">
                        <ul>
                            <li>
                                <a href="javascript:;" class="v2">
                                    <span class="title">子链申报管理</span>
                                </a>
                            </li>
                            <li>
                                <a href="javascript:;" class="v2">
                                    <span class="title">子链区块头</span>
                                </a>
                            </li>
                            <li>
                                <a href="javascript:;" class="v2">
                                    <span class="title">子链节点管理</span>
                                </a>
                            </li>
                            <li>
                                <a href="javascript:;" class="v2">
                                    <span class="title">子链用户管理</span>
                                </a>
                            </li>
                            <li>
                                <a href="javascript:;" class="v2">
                                    <span class="title">子链合约管理</span>
                                </a>
                            </li>
                        </ul>
                    </div>
                </li>
                <li>
                    <a href="javascript:;" class="v1">
                        <i class="icon_dn icon newiconfont newicon3-renzhengzhongxin"></i>
                        <span class="title">认证中心</span>
                        <i class="icon-arrow el-icon-arrow-down"></i>
                    </a>
                    <div class="slide-nav-subitem">
                        <ul>
                            <li>
                                <a href="/manage/authentication/certificateperson.html" class="v2">
                                    <span class="title">个人认证</span>
                                </a>
                            </li>
                            <li>
                                <a href="/manage/authentication/certificatecorp.html" class="v2">
                                    <span class="title">企业认证</span>
                                </a>
                            </li>
                            <li>
                                <a href="/manage/authentication/certificatenode.html" class="v2">
                                    <span class="title">节点认证</span>
                                </a>
                            </li>
                        </ul>
                    </div>
                </li>
                <li>
                    <a href="javascript:;" class="v1">
                        <i class="icon_dn icon newiconfont newicon6-quanxianguanli"></i>
                        <span class="title">权限管理</span>
                        <i class="icon-arrow el-icon-arrow-down"></i>
                    </a>
                    <div class="slide-nav-subitem">
                        <ul>
                            <li>
                                <a href="javascript:;" class="v2">
                                    <span class="title">角色管理</span>
                                </a>
                            </li>
                        </ul>
                    </div>
                </li>
                <li>
                    <a href="javascript:;" class="v1">
                        <i class="icon_dn icon iconfont iconicon_setting"></i>
                        <span class="title">系统管理</span>
                        <i class="icon-arrow el-icon-arrow-down"></i>
                    </a>
                    <div class="slide-nav-subitem">
                        <ul>
                            <li>
                                <a href="/manage/system/user.html" class="v2">
                                    <span class="title">用户管理</span>
                                </a>
                            </li>
                            <li>
                                <a href="/manage/system/dictbiz.html" class="v2">
                                    <span class="title">系统字典</span>
                                </a>
                            </li>
                            <li>
                                <a href="/manage/system/dictbiz.html" class="v2">
                                    <span class="title">业务字典</span>
                                </a>
                            </li>
                            <li>
                                <a href="/manage/system/menu.html" class="v2">
                                    <span class="title">菜单管理</span>
                                </a>
                            </li>
                        </ul>
                    </div>
                </li>
            </ul>
            <!-- 侧边导航 end -->
        </div>
    </div>
    <!-- 布局-侧边 end -->
    <!-- 布局-主内容 -->
    <div class="block-main">
        <div class="block-scrollbar">
            <!-- 主内容 -->
            <div class="block-2">
                <div class="block2-cont">
                    <div class="box-set5">
                        <div class="set-bd2">
                            <div class="set-item col-3">
                                <div class="tit">菜单名称:</div>
                                <div class="con">
                                    <input id="name" type="text" class="input-inner" placeholder="菜单名称" />
                                </div>
                            </div>
                            <div class="set-item col-3">
                                <div class="tit">菜单编号:</div>
                                <div class="con">
                                    <input id="code" type="text" class="input-inner" placeholder="菜单编号" />
                                </div>
                            </div>
                        </div>
                        <div class="set-bt set-bt_r">
                            <a href="javascript:;" class="primary-btn" id="search">
                                <i class="icon_dn el-icon-search"></i>
                                <span>搜索</span>
                            </a>
                            <a href="javascript:;" id="reset">
                                <i class="icon_dn el-icon-delete"></i>
                                <span>清空</span>
                            </a>
                        </div>
                    </div>
                    <div class="box-set6">
                        <div class="set-bt3" style="width: 100%;text-align: right;margin-bottom: 10px;">
                            <div id="refresh" class="item">
                                <a href="javascript:;" class="btn">
                                    <i class="el-icon-refresh"></i>
                                </a>
                                <div class="mask">
                                    <div class="popper__arrow"></div>
                                    <div class="tit">刷新</div>
                                </div>
                            </div>
                            <div class="item myfancy" data-href="#pop-xianyin">
                                <a href="javascript:;" class="btn">
                                    <i class="el-icon-s-operation"></i>
                                </a>
                                <div class="mask">
                                    <div class="popper__arrow"></div>
                                    <div class="tit">显隐</div>
                                </div>
                            </div>
                            <div class="item js_search_show_hide">
                                <a href="javascript:;" class="btn">
                                    <i class="el-icon-search"></i>
                                </a>
                                <div class="mask">
                                    <div class="popper__arrow"></div>
                                    <div class="tit">搜索</div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="data-content_2 table-scroll-x js-custom-radio-checkbox" data-modulename="formrel01">
                        <div class="table1-head table-6">
                            <table>
                                <thead>
                                <tr>
                                    <th width="100%">
                                        <div class="checkbox-item">
                                            <label><input type="checkbox" name="allCheckbox" onclick="selectAll()"/></label>
                                        </div>
                                    </th>
                                    <th class="table1_center" width="100%">#</th>
                                    <th name="xy_name" width="100%">菜单名称</th>
                                    <th name="xy_path" width="100%">路由地址</th>
                                    <th name="xy_parentName" width="100%">上级菜单</th>
                                    <th name="xy_source" width="100%">菜单图标</th>
                                    <th name="xy_code" width="100%">菜单编号</th>
                                    <th name="xy_type" width="100%">菜单类型</th>
                                    <th name="xy_alias" width="100%">菜单别名</th>
                                    <th name="xy_tools" width="100%">按钮功能</th>
                                    <th name="xy_sort" width="100%">菜单排序</th>
                                    <th name="xy_new" width="100%">新窗口</th>
                                    <th name="xy_remark" width="100%">菜单备注</th>
                                    <th class="table1_center" width="100%">操作</th>
                                </tr>
                                </thead>
                                <tbody id="table"></tbody>
                            </table>
                        </div>
                    </div>
                </div>
            </div>

            <div class="m-pop" id="pop-quanxianpeizhi">
                <div class="win-pop6">
                    <div class="win1-hd">
                        <div class="win1-btn">
                            <a href="javascript:;" class="close js-close" onclick="closeModel();">
                                <i class="el-dialog__close el-icon el-icon-close"></i>
                            </a>
                        </div>
                        <h3>数据权限配置</h3>
                    </div>
                    <div class="win-yhck">
                        <div class="block-2">
                            <div class="block2-cont">
                                <div class="box-set5">
                                    <div class="set-bd2">
                                        <div class="set-item col-3">
                                            <div class="tit">权限名称:</div>
                                            <div class="con">
                                                <input id="scopeName" type="text" class="input-inner" placeholder="权限名称" />
                                            </div>
                                        </div>
                                        <div class="set-item col-3">
                                            <div class="tit">权限编号:</div>
                                            <div class="con">
                                                <input id="resourceCode" type="text" class="input-inner" placeholder="权限编号" />
                                            </div>
                                        </div>
                                    </div>
                                    <div class="set-bt set-bt_r">
                                        <a href="javascript:;" class="primary-btn" id="searchRole">
                                            <i class="icon_dn el-icon-search"></i>
                                            <span>搜索</span>
                                        </a>
                                        <a href="javascript:;" id="resetRole">
                                            <i class="icon_dn el-icon-delete"></i>
                                            <span>清空</span>
                                        </a>
                                    </div>
                                </div>
                                <div class="box-set6">
                                    <div class="set-bt3">
                                        <div id="refreshRole" class="item">
                                            <a href="javascript:;" class="btn">
                                                <i class="el-icon-refresh"></i>
                                            </a>
                                            <div class="mask">
                                                <div class="popper__arrow"></div>
                                                <div class="tit">刷新</div>
                                            </div>
                                        </div>
                                        <div class="item myfancy" data-href="#pop-xianyin-role">
                                            <a href="javascript:;" class="btn">
                                                <i class="el-icon-s-operation"></i>
                                            </a>
                                            <div class="mask">
                                                <div class="popper__arrow"></div>
                                                <div class="tit">显隐</div>
                                            </div>
                                        </div>
                                        <div class="item js_search_show_hide">
                                            <a href="javascript:;" class="btn">
                                                <i class="el-icon-search"></i>
                                            </a>
                                            <div class="mask">
                                                <div class="popper__arrow"></div>
                                                <div class="tit">搜索</div>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="set-bt">
                                        <a href="javascript:;" class="primary-btn myfancy" data-href="#pop-juesexinzeng" onclick="initEditObj();">
                                            <i class="icon_dn el-icon-plus"></i>
                                            <span>新 增</span>
                                        </a>
                                        <a id="batch_delete" href="javascript:;" class="del-btn myfancy" data-href="#pop-shanchu3">
                                            <i class="icon_dn el-icon-delete"></i>
                                            <span>删 除</span>
                                        </a>
                                    </div>
                                </div>
                                <div class="data-content_2 table-scroll-x js-custom-radio-checkbox" data-modulename="formrel01">
                                    <div class="table1-head table-6">
                                        <table>
                                            <thead>
                                            <tr>
                                                <th width="100%">
                                                    <div class="checkbox-item">
                                                        <label><input type="checkbox" name="allCheckboxRole" onclick="selectAllRole()"/></label>
                                                    </div>
                                                </th>
                                                <th class="table1_center" width="100%">#</th>
                                                <th name="xy_scopeName" width="100%">权限名称</th>
                                                <th name="xy_resourceCode" width="100%">权限编号</th>
                                                <th name="xy_scopeColumn" width="100%">权限字段</th>
                                                <th name="xy_scopeTypeName" width="100%">规则类型</th>
                                                <th name="xy_scopeField" width="100%">可见字段</th>
                                                <th name="xy_scopeClass" width="100%">权限类名</th>
                                                <th name="xy_scopeValue" width="100%">规则值</th>
                                                <th name="xy_scopeRemark" width="100%">备注</th>
                                                <th class="table1_center" width="100%">操作</th>
                                            </tr>
                                            </thead>
                                            <tbody id="tableRole"></tbody>
                                        </table>
                                    </div>
                                </div>
                            </div>
                            <div id="pageable" class="pages">
                                <div id="total" class="pages-total"></div>
                                <div class="dropmenurel01 js-dropmenu" data-modulename="dropmenurel01">
                                    <input type="hidden" value="0">
                                    <div class="dropmenurel01-tit">
                                        <span>10条/页</span>
                                        <i class="el-input__icon el-icon-arrow-up"></i>
                                    </div>
                                    <div class="dropmenurel01-options js-dropmenu-options">
                                        <i class="popper__arrow"></i>
                                        <ul>
                                            <li data-value="1" onclick="changePageSize(10)">10条/页</li>
                                            <li data-value="2" onclick="changePageSize(20)">20条/页</li>
                                            <li data-value="3" onclick="changePageSize(30)">30条/页</li>
                                            <li data-value="4" onclick="changePageSize(40)">40条/页</li>
                                            <li data-value="5" onclick="changePageSize(50)">50条/页</li>
                                            <li data-value="6" onclick="changePageSize(100)">100条/页</li>
                                        </ul>
                                    </div>
                                </div>
                                <ul id="pageList"></ul>
                                <div class="pages-go">
                                    前往
                                    <input type="number" value="1" class="input-inner" id="pageNum" onChange="jumpPage()"/>
                                    页
                                    <div class="pages-prev pages-disable"><a href="javascript:;"><i class="el-icon el-icon-arrow-left"></i></a></div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <!-- 角色-新增 -->
            <div class="m-pop" id="pop-juesexinzeng">
                <div class="win-pop4">
                    <div class="win1-hd">
                        <div class="win1-btn">
                            <a href="javascript:;" class="fullscreen js-fullscreen">
                                <i class="el-icon-full-screen"></i>
                            </a>
                            <a href="javascript:;" class="close js-close">
                                <i class="el-icon-close"></i>
                            </a>
                        </div>
                        <h3>新 增</h3>
                    </div>
                    <div class="win3-bd">
                        <div class="form-1 form-5">
                            <form action="">
                                <div class="form-item col-2">
                                    <div class="tit"><span>*</span>权限名称:</div>
                                    <div class="con">
                                        <input id="scopeName_add" type="text" class="input-inner" placeholder="" onmouseout="validateInput('scopeName_add');">
                                    </div>
                                    <div class="con" style="color: red;display: none;" id="scopeName_add-error">请输入权限名称</div>
                                </div>
                                <div class="form-item col-2">
                                    <div class="tit"><span>*</span>权限编号:</div>
                                    <div class="con">
                                        <input id="resourceCode_add" type="text" class="input-inner" placeholder="" onmouseout="validateInput('resourceCode_add');">
                                    </div>
                                    <div class="con" style="color: red;display: none;" id="resourceCode_add-error">请输入权限编号</div>
                                </div>
                                <div class="form-item col-2">
                                    <div class="tit"><span>*</span>权限字段:</div>
                                    <div class="con">
                                        <input id="scopeColumn_add" type="text" class="input-inner" placeholder="" onmouseout="validateInput('scopeColumn_add');">
                                    </div>
                                    <div class="con" style="color: red;display: none;" id="scopeColumn_add-error">请输入权限字段</div>
                                </div>
                                <div class="form-item col-2">
                                    <div class="tit"><span>*</span>规则类型:</div>
                                    <div class="con">
                                        <select id="scopeType_add" onchange="dealTypeZdy('add');">
                                            <option value="">请选择规则类型</option>
                                        </select>
                                    </div>
                                    <div class="con" style="color: red;display: none;" id="scopeType_add-error">请选择规则类型</div>
                                </div>
                                <div class="form-item col-1">
                                    <div class="tit"><span>*</span>可见字段:</div>
                                    <div class="con">
                                        <input id="scopeField_add" type="text" class="input-inner" placeholder="" onmouseout="validateInput('scopeField_add');">
                                    </div>
                                    <div class="con" style="color: red;display: none;" id="scopeField_add-error">请输入数据权限可见的字段</div>
                                </div>
                                <div class="form-item col-1">
                                    <div class="tit"><span>*</span>权限类名:</div>
                                    <div class="con">
                                        <input id="scopeClass_add" type="text" class="input-inner" placeholder="" onmouseout="validateInput('scopeClass_add');">
                                    </div>
                                    <div class="con" style="color: red;display: none;" id="scopeClass_add-error">请输入MybatisMapper对应方法的完整类名路径</div>
                                </div>
                                <div class="form-item col-1" style="display: none;" id="scopeValue_add_div">
                                    <div class="tit">规则值:</div>
                                    <div class="con">
                                        <textarea id="scopeValue_add" cols="115" rows="5"></textarea>
                                    </div>
                                </div>
                                <div class="form-item col-1">
                                    <div class="tit">备注:</div>
                                    <div class="con">
                                        <input id="remark_add" type="text" class="input-inner" placeholder="">
                                    </div>
                                </div>
                            </form>
                        </div>
                    </div>
                    <div class="win-bt2">
                        <a href="javascript:;" class="primary-btn" onclick="submitForm('add')"><span><i
                                class="icon_dn el-icon-circle-close"></i>保存</span></a>
                        <a href="javascript:;" class="js-btn"><span><i
                                class="icon_dn el-icon-circle-plus-outline"></i>取消</span></a>
                    </div>
                </div>
            </div>
            <!-- 角色-新增 end -->
            <!-- 角色-查看 -->
            <div class="m-pop" id="pop-chakan">
                <div class="win-pop4">
                    <div class="win1-hd">
                        <div class="win1-btn">
                            <a href="javascript:;" class="fullscreen js-fullscreen">
                                <i class="el-icon-full-screen"></i>
                            </a>
                            <a href="javascript:;" class="close js-close">
                                <i class="el-icon-close"></i>
                            </a>
                        </div>
                        <h3>查 看</h3>
                    </div>
                    <div class="win3-bd">
                        <div class="form-1 form-5">
                            <form action="">
                                <div class="form-item col-2">
                                    <div class="tit"><span>*</span>权限名称:</div>
                                    <div class="con">
                                        <input id="scopeName_view" type="text" class="input-inner" placeholder="" disabled>
                                    </div>
                                </div>
                                <div class="form-item col-2">
                                    <div class="tit"><span>*</span>权限编号:</div>
                                    <div class="con">
                                        <input id="resourceCode_view" type="text" class="input-inner" placeholder="" disabled>
                                    </div>
                                </div>
                                <div class="form-item col-2">
                                    <div class="tit"><span>*</span>权限字段:</div>
                                    <div class="con">
                                        <input id="scopeColumn_view" type="text" class="input-inner" placeholder="" disabled>
                                    </div>
                                </div>
                                <div class="form-item col-2">
                                    <div class="tit"><span>*</span>规则类型:</div>
                                    <div class="con">
                                        <input id="scopeType_view" type="text" class="input-inner" placeholder="" disabled>
                                    </div>
                                </div>
                                <div class="form-item col-1">
                                    <div class="tit"><span>*</span>可见字段:</div>
                                    <div class="con">
                                        <input id="scopeField_view" type="text" class="input-inner" placeholder="" disabled>
                                    </div>
                                </div>
                                <div class="form-item col-1">
                                    <div class="tit"><span>*</span>权限类名:</div>
                                    <div class="con">
                                        <input id="scopeClass_view" type="text" class="input-inner" placeholder="" disabled>
                                    </div>
                                </div>
                                <div class="form-item col-1">
                                    <div class="tit">备注:</div>
                                    <div class="con">
                                        <input id="remark_view" type="text" class="input-inner" placeholder="" disabled>
                                    </div>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
            <!-- 角色-查看 end -->
            <!-- 角色-编辑 -->
            <div class="m-pop" id="pop-juesebianji">
                <div class="win-pop4">
                    <div class="win1-hd">
                        <div class="win1-btn">
                            <a href="javascript:;" class="fullscreen js-fullscreen">
                                <i class="el-icon-full-screen"></i>
                            </a>
                            <a href="javascript:;" class="close js-close">
                                <i class="el-icon-close"></i>
                            </a>
                        </div>
                        <h3>编 辑</h3>
                    </div>
                    <div class="win3-bd">
                        <div class="form-1 form-5">
                            <form action="">
                                <div class="form-item col-2">
                                    <div class="tit"><span>*</span>权限名称:</div>
                                    <div class="con">
                                        <input id="scopeName_edit" type="text" class="input-inner" placeholder="" onmouseout="validateInput('scopeName_edit');">
                                    </div>
                                    <div class="con" style="color: red;display: none;" id="scopeName_edit-error">请输入权限名称</div>
                                </div>
                                <div class="form-item col-2">
                                    <div class="tit"><span>*</span>权限编号:</div>
                                    <div class="con">
                                        <input id="resourceCode_edit" type="text" class="input-inner" placeholder="" onmouseout="validateInput('resourceCode_edit');">
                                    </div>
                                    <div class="con" style="color: red;display: none;" id="resourceCode_edit-error">请输入权限编号</div>
                                </div>
                                <div class="form-item col-2">
                                    <div class="tit"><span>*</span>权限字段:</div>
                                    <div class="con">
                                        <input id="scopeColumn_edit" type="text" class="input-inner" placeholder="" onmouseout="validateInput('scopeColumn_edit');">
                                    </div>
                                    <div class="con" style="color: red;display: none;" id="scopeColumn-edit-error">请输入权限字段</div>
                                </div>
                                <div class="form-item col-2">
                                    <div class="tit"><span>*</span>规则类型:</div>
                                    <div class="con">
                                        <select id="scopeType_edit" onchange="dealTypeZdy('edit');">
                                            <option value="">请选择规则类型</option>
                                        </select>
                                    </div>
                                    <div class="con" style="color: red;display: none;" id="scopeType_edit-error">请选择规则类型</div>
                                </div>
                                <div class="form-item col-1">
                                    <div class="tit"><span>*</span>可见字段:</div>
                                    <div class="con">
                                        <input id="scopeField_edit" type="text" class="input-inner" placeholder="" onmouseout="validateInput('scopeField_edit');">
                                    </div>
                                    <div class="con" style="color: red;display: none;" id="scopeField_edit-error">请输入数据权限可见的字段</div>
                                </div>
                                <div class="form-item col-1">
                                    <div class="tit"><span>*</span>权限类名:</div>
                                    <div class="con">
                                        <input id="scopeClass_edit" type="text" class="input-inner" placeholder="" onmouseout="validateInput('scopeClass_edit');">
                                    </div>
                                    <div class="con" style="color: red;display: none;" id="scopeClass_edit-error">请输入MybatisMapper对应方法的完整类名路径</div>
                                </div>
                                <div class="form-item col-1" style="display: none;" id="scopeValue_edit_div">
                                    <div class="tit">规则值:</div>
                                    <div class="con">
                                        <textarea id="scopeValue_edit" cols="115" rows="5"></textarea>
                                    </div>
                                </div>
                                <div class="form-item col-1">
                                    <div class="tit">备注:</div>
                                    <div class="con">
                                        <input id="remark_edit" type="text" class="input-inner" placeholder="">
                                    </div>
                                </div>
                            </form>
                        </div>
                    </div>
                    <div class="win-bt2">
                        <a href="javascript:;" class="primary-btn" onclick="submitForm('edit')"><span><i
                                class="el-icon-circle-check"></i>修改</span></a>
                        <a href="javascript:;" class="js-btn"><span><i
                                class="el-icon-circle-close"></i>取消</span></a>
                    </div>
                </div>
            </div>
            <!-- 角色-编辑 end -->
            <!-- 权限设置 -->
            <div class="m-pop" id="pop-quanxianshezhi">
                <div class="win-pop7">
                    <div class="win1-hd">
                        <div class="win1-btn">
                            <a href="javascript:;" class="close js-close">
                                <i class="el-icon-close"></i>
                            </a>
                        </div>
                        <h3>角色权限配置</h3>
                    </div>
                    <div class="win3-bd">
                        <div class="tabrel04 js-tabs js-anim" data-modulename="tabrel04">
                            <ul class="tabrel04-tit">
                                <li class="tabrel04-item tabrel04-item__on"><span class="subitem">菜单权限</span></li>
                                <li class="tabrel04-item"><span class="subitem">数据权限</span></li>
                                <li class="tabrel04-item"><span class="subitem">接口权限</span></li>
                            </ul>
                            <div class="tabrel04-desc">
                                <div class="tabrel04-item tabrel04-item__on">
                                    <div class="tree-ul js_tree js-custom-radio-checkbox"
                                         data-modulename="formrel01">
                                        <ul id="menuScope"></ul>
                                    </div>
                                </div>
                                <div class="tabrel04-item">
                                    <div class="tree-ul js_tree js-custom-radio-checkbox"
                                         data-modulename="formrel01">
                                        <ul id="dataScope"></ul>
                                    </div>
                                </div>
                                <div class="tabrel04-item">
                                    <div class="tree-ul js_tree js-custom-radio-checkbox"
                                         data-modulename="formrel01">
                                        <ul id="apiScope"></ul>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="win-bt2">
                        <a href="javascript:;" class="js-btn"><span>取消</span></a>
                        <a href="javascript:;" class="primary-btn" onclick="sumbitPermission()"><span>确定</span></a>
                    </div>
                </div>
            </div>
            <!-- 权限设置 end -->
            <!-- 主内容 end -->
        </div>
    </div>
    <!-- 布局-主内容 end -->
</div>
<div class="pop-bg"></div>
<div class="pop-bg1"></div>
<!-- 合约禁用弹窗 -->
<div class="m-pop" id="pop-heyuejinyong">
    <div class="win-pop1">
        <div class="win1-hd">
            <div class="win1-btn">
                <a href="javascript:;" class="close js-close">
                    <i class="el-icon-close"></i>
                </a>
            </div>
            <h3>合约禁用</h3>
        </div>
        <div class="win1-bd">
            <div class="win1-item">
                <div class="tit">禁用原因<span>*</span></div>
                <div class="con">
                    <input type="text" class="input-inner" />
                </div>
            </div>
        </div>
        <div class="win-bt">
            <a href="javascript:;" class="js-btn"><span>取 消</span></a>
            <a href="javascript:;" class="primary-btn"><span>确 定</span></a>
        </div>
    </div>
</div>
<!-- 合约禁用弹窗 end -->
<!-- 撤销弹窗 -->
<div class="m-pop" id="pop-chexiaozhengshu">
    <div class="win-pop1">
        <div class="win1-hd">
            <div class="win1-btn">
                <a href="javascript:;" class="close js-close">
                    <i class="el-icon-close"></i>
                </a>
            </div>
            <h3>撤销</h3>
        </div>
        <div class="win1-bd">
            <div class="win1-item">
                <div class="tit">撤销原因:</div>
                <div class="con">
                    <textarea class="textarea-inner" placeholder="请输入撤销原因"></textarea>
                </div>
            </div>
        </div>
        <div class="win-bt">
            <a href="javascript:;" class="primary-btn"><span>提交</span></a>
            <a href="javascript:;" class="js-btn"><span>返回</span></a>
        </div>
    </div>
</div>
<!-- 撤销弹窗 end -->
<!-- 禁用弹窗 -->
<div class="m-pop" id="pop-jinyong">
    <div class="win-pop3">
        <div class="win1-hd">
            <div class="win1-btn">
                <a href="javascript:;" class="close js-close">
                    <i class="el-icon-close"></i>
                </a>
            </div>
            <h3>提示</h3>
        </div>
        <div class="win3-bd">
            <div class="win3-item">
                <div class="icon_dn el-icon-info"></div>
                <div class="desc">
                    <p>您确定要禁用标识吗？</p>
                </div>
            </div>
        </div>
        <div class="win-bt2">
            <a href="javascript:;" class="js-btn"><span>取消</span></a>
            <a href="javascript:;" class="primary-btn"><span>确定</span></a>
        </div>
    </div>
</div>
<!-- 禁用弹窗 end -->
<!-- 启用弹窗 -->
<div class="m-pop" id="pop-qiyong">
    <div class="win-pop3">
        <div class="win1-hd">
            <div class="win1-btn">
                <a href="javascript:;" class="close js-close">
                    <i class="el-icon-close"></i>
                </a>
            </div>
            <h3>提示</h3>
        </div>
        <div class="win3-bd">
            <div class="win3-item">
                <div class="icon_dn el-icon-info"></div>
                <div class="desc">
                    <p>您确定要启用标识吗？</p>
                </div>
            </div>
        </div>
        <div class="win-bt2">
            <a href="javascript:;" class="js-btn"><span>取消</span></a>
            <a href="javascript:;" class="primary-btn"><span>确定</span></a>
        </div>
    </div>
</div>
<!-- 启用弹窗 end -->
<!-- 下载KeyStore -->
<div class="m-pop" id="pop-xiazaiKeyStore">
    <div class="win-pop3">
        <div class="win1-hd">
            <div class="win1-btn">
                <a href="javascript:;" class="close js-close">
                    <i class="el-icon-close"></i>
                </a>
            </div>
            <h3>提示</h3>
        </div>
        <div class="win3-bd">
            <div class="win3-item">
                <div class="tit">请输入创建人的私钥</div>
                <div class="con">
                    <input type="text" class="input-inner" />
                </div>
            </div>
        </div>
        <div class="win-bt2">
            <a href="javascript:;" class="js-btn"><span>取消</span></a>
            <a href="javascript:;" class="primary-btn"><span>确定</span></a>
        </div>
    </div>
</div>
<!-- 下载KeyStore end -->
<!-- 删除 -->
<div class="m-pop" id="pop-shanchu">
    <div class="win-pop3">
        <div class="win1-hd">
            <div class="win1-btn">
                <a href="javascript:;" class="close js-close">
                    <i class="el-icon-close"></i>
                </a>
            </div>
            <h3>提示</h3>
        </div>
        <div class="win3-bd">
            <div class="win3-item">
                <div class="icon_dn el-icon-warning"></div>
                <div class="desc">
                    <p>此操作将永久删除该数据, 是否继续?</p>
                </div>
            </div>
        </div>
        <div class="win-bt2">
            <a href="javascript:;" class="js-btn"><span>取消</span></a>
            <a href="javascript:;" class="primary-btn"><span>确定</span></a>
        </div>
    </div>
</div>
<!-- 删除 end -->
<!-- 删除2 -->
<div class="m-pop" id="pop-shanchu2">
    <div class="win-pop3">
        <div class="win1-hd">
            <div class="win1-btn">
                <a href="javascript:;" class="close js-close">
                    <i class="el-icon-close"></i>
                </a>
            </div>
            <h3>提示</h3>
        </div>
        <div class="win3-bd">
            <div class="win3-item">
                <div class="icon_dn el-icon-info"></div>
                <div class="desc">
                    <p>确定删除选中角色?</p>
                </div>
            </div>
        </div>
        <div class="win-bt2">
            <a href="javascript:;" class="js-btn"><span>取消</span></a>
            <a href="javascript:;" class="primary-btn"><span>确定</span></a>
        </div>
    </div>
</div>
<!-- 删除2 end -->
<!-- 删除3 -->
<div class="m-pop" id="pop-shanchu3">
    <div class="win-pop3">
        <div class="win1-hd">
            <div class="win1-btn">
                <a href="javascript:;" class="close js-close">
                    <i class="el-icon-close"></i>
                </a>
            </div>
            <h3>提示</h3>
        </div>
        <div class="win3-bd">
            <div class="win3-item">
                <div class="icon_dn el-icon-warning"></div>
                <div class="desc">
                    <p>确定将选择数据删除?</p>
                </div>
            </div>
        </div>
        <div class="win-bt2">
            <a href="javascript:;" class="js-btn"><span>取消</span></a>
            <a href="javascript:;" class="primary-btn" onclick="deleteRole('3')"><span>确定</span></a>
        </div>
    </div>
</div>
<!-- 删除3 end -->
<!-- 删除4 -->
<div class="m-pop" id="pop-shanchu4">
    <div class="win-pop3">
        <div class="win1-hd">
            <div class="win1-btn">
                <a href="javascript:;" class="close js-close">
                    <i class="el-icon-close"></i>
                </a>
            </div>
            <h3>提示</h3>
        </div>
        <div class="win3-bd">
            <div class="win3-item">
                <div class="icon_dn el-icon-warning"></div>
                <div class="desc">
                    <p>确定将选择数据删除?</p>
                </div>
            </div>
        </div>
        <div class="win-bt2">
            <a href="javascript:;" class="js-btn"><span>取消</span></a>
            <a href="javascript:;" class="primary-btn" onclick="deleteRole('4')"><span>确定</span></a>
        </div>
    </div>
</div>
<!-- 删除4 end -->
<!-- 移至黑名单 -->
<div class="m-pop" id="pop-yizhiheimingdan">
    <div class="win-pop3">
        <div class="win1-hd">
            <div class="win1-btn">
                <a href="javascript:;" class="close js-close">
                    <i class="el-icon-close"></i>
                </a>
            </div>
            <h3>提示</h3>
        </div>
        <div class="win3-bd">
            <div class="win3-item">
                <div class="icon_dn el-icon-warning"></div>
                <div class="desc">
                    <p>确定将该用户移至黑名单吗?</p>
                </div>
            </div>
        </div>
        <div class="win-bt2">
            <a href="javascript:;" class="js-btn"><span>取消</span></a>
            <a href="javascript:;" class="primary-btn"><span>确定</span></a>
        </div>
    </div>
</div>
<!-- 移至黑名单 end -->
<!-- 升至管理员 -->
<div class="m-pop" id="pop-shengzhiguanliyuan">
    <div class="win-pop3">
        <div class="win1-hd">
            <div class="win1-btn">
                <a href="javascript:;" class="close js-close">
                    <i class="el-icon-close"></i>
                </a>
            </div>
            <h3>提示</h3>
        </div>
        <div class="win3-bd">
            <div class="win3-item">
                <div class="icon_dn el-icon-warning"></div>
                <div class="desc">
                    <p>确定将该用户添加至管理员?</p>
                </div>
            </div>
        </div>
        <div class="win-bt2">
            <a href="javascript:;" class="js-btn"><span>取消</span></a>
            <a href="javascript:;" class="primary-btn"><span>确定</span></a>
        </div>
    </div>
</div>
<!-- 升至管理员 end -->
<!-- 移除管理员 -->
<div class="m-pop" id="pop-yichuguanliyuan">
    <div class="win-pop3">
        <div class="win1-hd">
            <div class="win1-btn">
                <a href="javascript:;" class="close js-close">
                    <i class="el-icon-close"></i>
                </a>
            </div>
            <h3>提示</h3>
        </div>
        <div class="win3-bd">
            <div class="win3-item">
                <div class="icon_dn el-icon-info"></div>
                <div class="desc">
                    <p>确定移除该用户管理员?</p>
                </div>
            </div>
        </div>
        <div class="win-bt2">
            <a href="javascript:;" class="js-btn"><span>取消</span></a>
            <a href="javascript:;" class="primary-btn"><span>确定</span></a>
        </div>
    </div>
</div>
<!-- 移除管理员 end -->
<!-- 重置密码 -->
<div class="m-pop" id="pop-chongzhimima">
    <div class="win-pop3">
        <div class="win1-hd">
            <div class="win1-btn">
                <a href="javascript:;" class="close js-close">
                    <i class="el-icon-close"></i>
                </a>
            </div>
            <h3>请输入接收密码的邮箱</h3>
        </div>
        <div class="win3-bd">
            <div class="form-1 form-4">
                <form action="">
                    <div class="form-item col-1">
                        <div class="tit"></div>
                        <div class="con">
                            <input type="text" class="input-inner" placeholder="">
                        </div>
                    </div>
                </form>
            </div>
        </div>
        <div class="win-bt2">
            <a href="javascript:;" class="js-btn"><span>取消</span></a>
            <a href="javascript:;" class="primary-btn"><span>确定</span></a>
        </div>
    </div>
</div>
<!-- 重置密码 end -->
<!-- 钱包解锁弹窗 -->
<div class="m-pop" id="pop-qianbaojiesuo">
    <div class="win-pop2">
        <div class="win1-hd">
            <div class="win1-btn">
                <a href="javascript:;" class="close js-close">
                    <i class="el-dialog__close el-icon el-icon-close"></i>
                </a>
            </div>
            <h3>钱包解锁</h3>
        </div>
        <div class="win1-bd">
            <div class="win2-item">
                <div class="tit">请选择方式：</div>
                <div class="con">
                    <ul class="radio-group js-custom-radio-checkbox" data-modulename="formrel01">
                        <li data-selectName=".item-select1">
                            <label>
                                <input type="radio" name="1" checked />
                                <i class="icon"></i>
                                <span>BID keystore 文件</span>
                            </label>
                        </li>
                        <li data-selectName=".item-select2">
                            <label>
                                <input type="radio" name="1" />
                                <i class="icon"></i>
                                <span>BID私钥</span>
                            </label>
                        </li>
                    </ul>
                </div>
            </div>
            <div class="win2-item item-select1">
                <div class="tit">请选择BID Keystore文件</div>
                <div class="con">
                    <div class="file-upload_box3">
                        <div class="fileUpload-btn3">
                            <label>
                                <input type="file" class="js-upload">
                                <span><i class="icon_dn el-icon-upload e-upload"></i>选择文件</span>
                            </label>
                        </div>
                        <ul class="fileUpload-files">
                            <!-- <li>
                            <a href="javascript:;">
                                <i class="el-icon-document"></i>
                                <span>5cd67b13-740e-4f77-b950-09e47e60881d (1).json</span>
                            </a>
                            <i class="el-icon-close"></i>
                        </li> -->
                        </ul>
                    </div>
                </div>
            </div>
            <div class="win2-item col-1 item-select1">
                <div class="tit">请输入密码：</div>
                <div class="con">
                    <div class="input-suffix">
                        <input type="password" class="input-inner" placeholder="请输入密码" />
                        <div class="icon">
                            <i class="el-input__icon i-changetype el-icon-view"></i>
                            <i class="el-input__icon el-icon-circle-close"></i>
                        </div>
                    </div>
                </div>
            </div>
            <div class="win2-item col-1 item-select2">
                <div class="tit">请输入BID私钥：</div>
                <div class="con">
                    <div class="input-suffix">
                        <input type="password" class="input-inner" placeholder="请输入BID私钥" />
                        <div class="icon">
                            <i class="el-input__icon i-changetype el-icon-view"></i>
                            <i class="el-input__icon el-icon-circle-close"></i>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="win-bt win-bt_center">
            <a href="javascript:;" class="js-btn"><span>取 消</span></a>
            <a href="javascript:;" class="primary-btn"><span>确 定</span></a>
        </div>
    </div>
</div>

<div class="m-pop" id="pop-xianyin-role">
    <div class="win-pop5">
        <div class="win1-hd">
            <div class="win1-btn">
                <a href="javascript:;" class="close js-close">
                    <i class="el-dialog__close el-icon el-icon-close"></i>
                </a>
            </div>
            <h3>多 选</h3>
        </div>
        <div class="win1-bd">
            <ul class="checkbox-group2 js-custom-radio-checkbox" data-modulename="formrel01">
                <li><label><input onchange="chooseXyRole();" type="checkbox" name="xianyinRole" value="xy_scopeName" checked="checked"/>
                    <i class="icon"></i><span>权限名称</span></label></li>
                <li><label><input onchange="chooseXyRole();" type="checkbox" name="xianyinRole" value="xy_resourceCode" checked="checked"/>
                    <i class="icon"></i><span>权限编号</span></label></li>
                <li><label><input onchange="chooseXyRole();" type="checkbox" name="xianyinRole" value="xy_scopeColumn" checked="checked"/>
                    <i class="icon"></i><span>权限字段</span></label></li>
                <li><label><input onchange="chooseXyRole();" type="checkbox" name="xianyinRole" value="xy_scopeTypeName" checked="checked"/>
                    <i class="icon"></i><span>规则类型</span></label></li>
                <li><label><input onchange="chooseXyRole();" type="checkbox" name="xianyinRole" value="xy_scopeField"/>
                    <i class="icon"></i><span>可见字段</span></label></li>
                <li><label><input onchange="chooseXyRole();" type="checkbox" name="xianyinRole" value="xy_scopeClass"/>
                    <i class="icon"></i><span>权限类名</span></label></li>
                <li><label><input onchange="chooseXyRole();" type="checkbox" name="xianyinRole" value="xy_scopeValue"/>
                    <i class="icon"></i><span>规则值</span></label></li>
                <li><label><input onchange="chooseXyRole();" type="checkbox" name="xianyinRole" value="xy_scopeRemark"/>
                    <i class="icon"></i><span>备注</span></label></li>
            </ul>
        </div>
    </div>
</div>

<!-- 钱包解锁弹窗 end -->
<!-- 显隐 -->
<div class="m-pop" id="pop-xianyin">
    <div class="win-pop5">
        <div class="win1-hd">
            <div class="win1-btn">
                <a href="javascript:;" class="close js-close">
                    <i class="el-dialog__close el-icon el-icon-close"></i>
                </a>
            </div>
            <h3>多 选</h3>
        </div>
        <div class="win1-bd">
            <ul class="checkbox-group2 js-custom-radio-checkbox" data-modulename="formrel01">
                <li><label><input onchange="chooseXy();" type="checkbox" name="xianyin" value="xy_name" id="xy_name" checked="checked"/><i class="icon"></i><span>菜单名称</span></label></li>
                <li><label><input onchange="chooseXy();" type="checkbox" name="xianyin" value="xy_path" id="xy_path" checked="checked"/><i class="icon"></i><span>路由地址</span></label></li>
                <li><label><input onchange="chooseXy();" type="checkbox" name="xianyin" value="xy_parentName" id="xy_parentName"/><i class="icon"></i><span>上级菜单</span></label></li>
                <li><label><input onchange="chooseXy();" type="checkbox" name="xianyin" value="xy_source" id="xy_source" checked="checked"/><i class="icon"></i><span>菜单图标</span></label></li>
                <li><label><input onchange="chooseXy();" type="checkbox" name="xianyin" value="xy_code" id="xy_code" checked="checked"/><i class="icon"></i><span>菜单编号</span></label></li>
                <li><label><input onchange="chooseXy();" type="checkbox" name="xianyin" value="xy_type" id="xy_type"/><i class="icon"></i><span>菜单类型</span></label></li>
                <li><label><input onchange="chooseXy();" type="checkbox" name="xianyin" value="xy_alias" id="xy_alias" checked="checked"/><i class="icon"></i><span>菜单别名</span></label></li>
                <li><label><input onchange="chooseXy();" type="checkbox" name="xianyin" value="xy_tools" id="xy_tools"/><i class="icon"></i><span>按钮功能</span></label></li>
                <li><label><input onchange="chooseXy();" type="checkbox" name="xianyin" value="xy_sort" id="xy_sort" checked="checked"/><i class="icon"></i><span>菜单排序</span></label></li>
                <li><label><input onchange="chooseXy();" type="checkbox" name="xianyin" value="xy_new" id="xy_new"/><i class="icon"></i><span>新窗口</span></label></li>
                <li><label><input onchange="chooseXy();" type="checkbox" name="xianyin" value="xy_remark" id="xy_remark"/><i class="icon"></i><span>菜单备注</span></label></li>
            </ul>
        </div>
    </div>
</div>
<!-- 显隐 end -->
<script src="/js/module.js"></script>
<script>
    var requestUrl = getRequestUrl();
    var currentPage = 1;
    var currentSize = 10;
    var num = 0
    var selectList = {};
    var tableData = [];
    // 需要删除的数据
    var removeList=[];
    // 编辑的数据
    var editObj={};
    // 是否选择全部
    var isSelectedAll = false;
    var tableDataRole = [];
    var menuId = "";
    var menuName = "";
    var isSelectedAllRole = false;

    // 服务组
    var selectgroup = function () {
        $request({
            url: requestUrl + '/tenant/select',
        }, function (res) {
            var template = '';
            $.each(res, function(i, x){
                template += "<li onclick='selectChange(" + x.tenantId + ")' data-value='" + x.tenantId + "'>" + x.tenantName + "</li>"
            });
            $('#select').append(template);
            $.each(res, function(i, x){
                selectList[x.tenantId] = x.tenantName;
            })
            getData();
        });
    };
    //
    function selectChange(tenantId) {
        console.log("tenantId",tenantId)
    }
    // 展开或者收起
    function switchTree(e){
        var display=$(e).parent().next().children().css('display')
        if(display==='list-item'){
            $(e).parent().next().children().css('display','none')
            $(e).css("transform",'rotate(0deg)')
        }else{
            $(e).parent().next().children().css('display','list-item')
            $(e).css("transform",'rotate(90deg)')
        }
    }
    // 角色权限配置操作树
    function selectChecbox(e){
        if($(e).attr("checked")){
            $(e).attr("checked",false).parent().removeClass("formrel01-chk__checked")
        }else{
            $(e).attr("checked",true).parent().addClass("formrel01-chk__checked")
        }
    }

    // 刷新
    $('#refresh').click(function(){
        getData();
    })
    // 搜索
    $('#search').click(function () {
        currentPage = 1;
        getData();
    })
    // 清空
    $('#reset').click(function () {
        $('#name').val('');
        $('#code').val('');
        currentPage = 1;
        getData();
    })

    $("#refreshRole").click(function(){
        currentPage = 1;
        getDataRole(menuId);
    })
    // 搜索
    $('#searchRole').click(function () {
        currentPage = 1;
        getDataRole(menuId);
    })
    // 清空
    $('#resetRole').click(function () {
        $('#scopeName').val('');
        $('#resourceCode').val('');
        currentPage = 1;
        getDataRole(menuId);
    })


    // 权限设置按钮
    $("#permission_set").click(function(){
        var selecteds=[]
        $("input[name='checkbox']:checked").each(function (index, item) {
            console.log("item",$(item).val())
            selecteds.push($(item).val());
        });
        if(selecteds.length===1){
            $('#pop-quanxianshezhi').fadeIn("normal");
            $('.pop-bg').addClass('open');
            getGrantTree();
        }else if(selecteds.length===0){
            alert("至少选择一条数据");
        }else if(selecteds.length>1){
            alert("只能选择一条数据");
        }
    })
    // 批量删除
    $("#batch_delete").click(function(e){
        removeList=[];
        $("input[name='checkboxRole']:checked").each(function (index, item) {
            removeList.push($(item).val());
        });
    })
    // 查看按钮
    function view(index,e){
        var _id = $(e).attr('data-href');
        $(_id).fadeIn("normal");
        $('.pop-bg1').addClass('open');
        var detail = tableData[Number(index)];
        menuId = detail.id;
        menuName = detail.name;
        getDataRole(detail.id);
    }

    function viewRole(index,e){
        var _id = $(e).attr('data-href');
        $(_id).fadeIn("normal");
        $('.pop-bg').addClass('open');
        var detail = tableDataRole[Number(index)];
        var currentItemId = detail.id;
        getCurrentObj(currentItemId, "view")
    }

    // 查询字典值
    var lstScopeType = [];
    function getScopeType(){
        $request({
            url: requestUrl + '/dict/dictionary?code=data_scope_type',
            method: 'get',
            data: {}
        }, function (res) {
            lstScopeType = res;
            var scopeTypeArr = [];
            $.each(res, function(i, x){
                scopeTypeArr.push('<option value="' + x.dictKey + '">' + x.dictValue + '</option>');
            })
            $("#scopeType_add").append(scopeTypeArr.join(""));
            $("#scopeType_edit").append(scopeTypeArr.join(""));
        });
    }

    // 编辑按钮
    function edit(index,e){
        var _id = $(e).attr('data-href');
        $(_id).fadeIn("normal");
        $('.pop-bg').addClass('open');
        var detail = tableDataRole[Number(index)];
        var currentItemId = detail.id;
        getCurrentObj(currentItemId, "edit");
    }

    function getCurrentObj(id, type){
        $request({
            url: requestUrl + '/data-scope/detail?id=' + id,
            method: 'get',
            data: {}
        }, function (res) {
            editObj = res;
            $("#scopeName_" + type + "").val(res.scopeName);
            $("#resourceCode_" + type + "").val(res.resourceCode);
            $("#scopeColumn_" + type + "").val(res.scopeColumn);
            $("#scopeField_" + type + "").val(res.scopeField);
            $("#scopeClass_" + type + "").val(res.scopeClass);
            $("#remark_" + type + "").val(res.remark);
            if(type == "view"){
                $("#scopeType_" + type + "").val(getScopeTypeValue(res.scopeType));
            }else{
                $("#scopeType_" + type + "").val(res.scopeType);
            }
            if(res.scopeType == "5"){
                $("#scopeValue_" + type + "_div").show();
                $("#scopeValue_" + type + "").val(res.scopeValue);
            }else{
                $("#scopeValue_" + type + "_div").hide();
                $("#scopeValue_" + type + "").val("");
            }
        });
    }

    function dealTypeZdy(type){
        var scopeType = $("#scopeType_" + type + " option:selected").val();
        if(scopeType == ""){
            $("#scopeType_" + type + "-error").show();
            return false;
        }
        $("#scopeType_" + type + "-error").hide();
        if(scopeType == "5"){
            $("#scopeValue_" + type + "_div").show();
        }else{
            $("#scopeValue_" + type + "_div").hide();
        }
    }

    function getScopeTypeValue(scopeType){
        var scopeTypeValue = "";
        $.each(lstScopeType, function(i, x){
            if(x.dictKey == scopeType){
                scopeTypeValue =  x.dictValue;
            }
        });
        return scopeTypeValue;
    }

    var getDataRole = function (menuId) {
        var scopeName = $('#scopeName').val();
        var resourceCode = $('#resourceCode').val();
        $request({
            url: requestUrl + '/data-scope/list?menuId=' +  menuId + '&current=' + currentPage + '&size=' + currentSize,
            data: {
                scopeName: scopeName,
                resourceCode: resourceCode
            }
        }, function (res) {
            tableDataRole = res.records;
            var template = '';
            $('#tableRole').children().remove();
            if(tableDataRole == "" || tableDataRole.length === 0){
                template += "<tr><td colspan='8' style='text-align: center;'>暂无数据</td></tr>";
                $('#tableRole').append(template);
                return;
            }
            $.each(tableDataRole, function(i, x){
                template += "<tr>" +
                    "<td>" +
                    "   <div class='checkbox-item'>" +
                    "       <label><input type='checkbox' name='checkboxRole' value="+x.id+" onclick='selectCheckBoxRole(this)'/></label>" +
                    "   </div>" +
                    "</td>" +
                    "<td class='table1_center'>" + (i + 1) + "</td>" +
                    "<td name='xy_scopeName'>" + x.scopeName + "</td>" +
                    "<td name='xy_resourceCode'>" + x.resourceCode + "</td>" +
                    "<td name='xy_scopeColumn'>" + x.scopeColumn + "</td>" +
                    "<td name='xy_scopeTypeName'><div class='table1-tag'><span>" + x.scopeTypeName + "</span></div></td>" +
                    "<td name='xy_scopeField'>" + x.scopeField + "</td>" +
                    "<td name='xy_scopeClass'>" + x.scopeClass + "</td>" +
                    "<td name='xy_scopeValue'>" + x.scopeValue + "</td>" +
                    "<td name='xy_scopeRemark'>" + x.remark + "</td>" +
                    "<td class='table1_center'>" +
                    "   <div class='table1-btn'>" +
                    "       <a href='javascript:;' class='myfancy' data-href='#pop-chakan' onclick='viewRole("+i+",this)'><i class='icon_dn el-icon-view'></i>查看</a>" +
                    "       <a href='javascript:;' class='myfancy' data-href='#pop-juesebianji' onclick='edit("+i+",this)'><i class='icon_dn el-icon-edit'></i>编辑</a>" +
                    "       <a href='javascript:;' class='myfancy' data-href='#pop-shanchu4' onclick='deleteBtn("+i+",this)'><i class='icon_dn el-icon-delete'></i>删除</a>" +
                    "   </div>" +
                    "</td>" +
                    "</tr>";
            });
            $('#tableRole').append(template);
            if(res.total){
                $('#pageable').show()
                $('#total').html("共"+res.total+"条")
                num =Math.ceil(res.total / currentSize);
                pageNumInit(num)
            }else{
                $('#pageable').hide()
            }
        })
        // 显示隐藏列数据
        setTimeout(function(){chooseXyRole();}, 200);
    }

    function chooseXyRole(){
        $("input[name='xianyinRole']").each(function(i, n){
            var value = $(this).val();
            if($(this).is(':checked')){
                $("td[name='" + value + "']").show();
                $("th[name='" + value + "']").show();
            }else{
                $("td[name='" + value + "']").hide();
                $("th[name='" + value + "']").hide();
            }
        });
    }

    // 删除按钮
    function deleteBtn(index,e){
        var _id = $(e).attr('data-href');
        $(_id).fadeIn("normal");
        $('.pop-bg').addClass('open');
        var id = tableDataRole[Number(index)].id
        removeList=[id]
    }
    // 选择全部
    function selectAll(){
        if(isSelectedAll){
            $("input[name='checkbox']").each(function(i,item){
                item.checked = false
            })
            isSelectedAll = false
        }else{
            $("input[name='checkbox']").each(function(i,item){
                item.checked = true
            })
            isSelectedAll = true
        }
    }

    // 选择全部
    function selectAllRole(){
        if(isSelectedAllRole){
            $("input[name='checkboxRole']").each(function(i,item){
                item.checked = false
            })
            isSelectedAllRole = false
        }else{
            $("input[name='checkboxRole']").each(function(i,item){
                item.checked = true
            })
            isSelectedAllRole = true
        }
    }

    // 行checkbox选择
    function selectCheckBox(e){
        if($(e).attr("checked")){
            $(e).attr("checked",false).parent().removeClass("formrel01-chk__checked")
        }else{
            $(e).attr("checked",true).parent().addClass("formrel01-chk__checked")
        }
    }

    function selectCheckBoxRole(e){
        if($(e).attr("checked")){
            $(e).attr("checked",false).parent().removeClass("formrel01-chk__checked")
        }else{
            $(e).attr("checked",true).parent().addClass("formrel01-chk__checked")
        }
    }

    // 表格
    var getData = function () {
        var name = $('#name').val();
        var code = $('#code').val();
        $request({
            url: requestUrl + '/menu/lazy-menu-list?parentId=0',
            data: {
                name: name,
                code: code
            }
        }, function (res) {
            tableData = res;
            var template = '';
            $('#table').children().remove();
            $.each(tableData, function(i, x){
                template += "<tr>" +
                    "<td>" +
                    "   <div class='checkbox-item'>" +
                    "       <label><input type='checkbox' name='checkbox' value="+x.id+" onclick='selectCheckBox(this)'/></label>" +
                    "   </div>" +
                    "</td>" +
                    "<td class='table1_center'>" + (i + 1) + "</td>" +
                    "<td name='xy_name'>" + x.name + "</td>" +
                    "<td name='xy_path'>" + x.path + "</td>" +
                    "<td name='xy_parentName'>" + (x.parentName == "" ? "0" : x.parentName) + "</td>" +
                    "<td name='xy_source'>" +
                    "   <div class='cell'><span><i class='"+x.source+"'></i></span></div>"+
                    "</td>" +
                    "<td name='xy_code'>" + x.code + "</td>" +
                    "<td name='xy_type'>菜单</td>" +
                    "<td name='xy_alias'>" + x.alias + "</td>" +
                    "<td name='xy_tools'>工具栏</td>" +
                    "<td name='xy_sort'>" + x.sort + "</td>" +
                    "<td name='xy_new'>是</td>" +
                    "<td name='xy_remark'>" + x.remark + "</td>" +
                    "<td class='table1_center'>" +
                    "   <div class='table1-btn'>" +
                    "       <a href='javascript:;' class='myfancy' data-href='#pop-quanxianpeizhi' onclick='view("+i+",this)'><i class='icon_dn el-icon-edit'></i>权限配置</a>" +
                    "   </div>" +
                    "</td>" +
                    "</tr>";
            });
            $('#table').append(template);
        })
        // 显示隐藏列数据
        setTimeout(function(){chooseXy();}, 200);
    }

    function chooseXy(){
        $("input[name='xianyin']").each(function(i, n){
            var value = $(this).val();
            if($(this).is(':checked')){
                $("td[name='" + value + "']").show();
                $("th[name='" + value + "']").show();
            }else{
                $("td[name='" + value + "']").hide();
                $("th[name='" + value + "']").hide();
            }
        });
    }

    function validateInput(item){
        var value = $("#" + item + "").val();
        if(value == ""){
            $("#" + item + "-error").show();
            return false;
        }
        $("#" + item + "-error").hide();
        return true;
    }

    // 新增/修改
    function submitForm(type){
        if(!validateInput('scopeName_' + type + '') || !validateInput('resourceCode_' + type + '') || !validateInput('scopeColumn_' + type + '')
            || !validateInput('scopeField_' + type + '') || !validateInput('scopeClass_' + type + '')){
            return false;
        }
        var scopeType = $("#scopeType_" + type + " option:selected").val();
        if(scopeType == ""){
            $("#scopeType_" + type + "-error").show();
            return false;
        }
        $("#scopeType_" + type + "-error").hide();
        var scopeName = $("#scopeName_"+type).val();
        var resourceCode = $("#resourceCode_"+type).val();
        var scopeColumn = $("#scopeColumn_"+type).val();
        var scopeField = $("#scopeField_"+type).val();
        var scopeClass = $("#scopeClass_"+type).val();
        var remark = $("#remark_"+type).val();
        var scopeType = $("#scopeType_" + type + " option:selected").val();
        var scopeValue = scopeType == "5" ? $("#scopeValue_"+type).val() : "";

        editObj.scopeName = scopeName;
        editObj.resourceCode = resourceCode;
        editObj.scopeColumn = scopeColumn;
        editObj.scopeField = scopeField;
        editObj.scopeClass = scopeClass;
        editObj.remark = remark;
        editObj.scopeType = scopeType;
        editObj.scopeValue = scopeValue;
        editObj.menuId = menuId;

        $request({
            url: requestUrl + '/data-scope/submit',
            method: 'post',
            data:JSON.stringify(editObj),
        },function(e){
            editObj = {};
            $("#scopeName_"+type).val('');
            $("#resourceCode_"+type).val('');
            $("#scopeColumn_"+type).val('');
            $("#scopeField_"+type).val('');
            $("#scopeClass_"+type).val('');
            $("#remark_"+type).val('');
            $("#scopeType_"+type).val('');
            if(type==="edit"){
                $("#pop-juesebianji").fadeOut("normal");
            }else{
                $("#pop-juesexinzeng").fadeOut("normal");
            }
            $('.pop-bg').removeClass('open');
            getDataRole(menuId);
        })
    }
    // 删除角色
    function deleteRole(num){
        var ids = removeList.join();
        if(ids == ""){
            alert("请选择需要删除的数据");
            return;
        }
        $request({
            url: requestUrl + '/data-scope/remove',
            method: 'post',
            data: {
                ids: ids
            },
            contentType: 'application/x-www-form-urlencoded'
        },function(e){
            $("#pop-shanchu"+num).fadeOut("normal");
            $('.pop-bg').removeClass('open');
            getDataRole(menuId);
        })
    }
    // 权限分配树
    function getGrantTree(){
        $request({
            url: requestUrl + '/menu/grant-tree',
            method: 'get',
        }, function(res) {
            $("input[name='checkbox']:checked").each(function (index, item) {
                getRoleTree($(item).val());
            });
            var menuTemplate = ''
            var dataTemplate = ''
            var apiTemplate = ''
            if(res.menu.length){
                $.each(res.menu, function(i, x){
                    menuTemplate += "<li>" +
                        "<div class='title'>" +
                        "<i onclick='switchTree(this)' class='el-icon-caret-right icon-calendar"+(x.hasChildren?' icon-plus-sign':'')+"'></i>" +
                        "<div class='checkbox-item'>" +
                        "<label>" +
                        "<input type='checkbox' name='menucheckbox' value="+x.id+" onclick='selectChecbox(this)'/>" +
                        "</label>" +
                        "</div>" +
                        "<span class='name'>"+x.title+"</span>" +
                        "</div>";
                    if(x.hasChildren){
                        menuTemplate = renderChildren(x.children,menuTemplate,'menu')
                    }
                    menuTemplate += "</li>";
                })
            }else{
                menuTemplate += "<div class='none-data'>" +
                    "<p>暂无数据</p>" +
                    "</div>"
            }
            if(res.dataScope.length){
                $.each(res.dataScope, function(i, x){
                    dataTemplate += "<li>" +
                        "<div class='title'>" +
                        "<i onclick='switchTree(this)' class='el-icon-caret-right icon-calendar"+(x.hasChildren?' icon-plus-sign':'')+"'></i>" +
                        "<div class='checkbox-item'>" +
                        "<label>" +
                        "<input type='checkbox' name='datacheckbox' value="+x.id+" onclick='selectChecbox(this)'/>" +
                        "</label>" +
                        "</div>" +
                        "<span class='name'>"+x.title+"</span>" +
                        "</div>";
                    if(x.hasChildren){
                        dataTemplate = renderChildren(x.children,dataTemplate,'data')
                    }
                    dataTemplate += "</li>";
                })
            }else{
                dataTemplate += "<div class='none-data'>" +
                    "<p>暂无数据</p>" +
                    "</div>"
            }
            if(res.apiScope.length){
                $.each(res.apiScope, function(i, x){
                    apiTemplate += "<li>" +
                        "<div class='title'>" +
                        "<i onclick='switchTree(this)' class='el-icon-caret-right icon-calendar"+(x.hasChildren?' icon-plus-sign':'')+"'></i>" +
                        "<div class='checkbox-item'>" +
                        "<label>" +
                        "<input type='checkbox' name='apicheckbox' value="+x.id+" onclick='selectChecbox(this)'/>" +
                        "</label>" +
                        "</div>" +
                        "<span class='name'>"+x.title+"</span>" +
                        "</div>";
                    if(x.hasChildren){
                        apiTemplate = renderChildren(x.children,apiTemplate,'api')
                    }
                    apiTemplate += "</li>";
                })
            }else{
                apiTemplate += "<div class='none-data'>" +
                    "<p>暂无数据</p>" +
                    "</div>"
            }
            console.log(menuTemplate)
            $('#menuScope').children().remove();
            $('#dataScope').children().remove();
            $('#apiScope').children().remove();
            $('#menuScope').append(menuTemplate)
            $('#dataScope').append(dataTemplate)
            $('#apiScope').append(apiTemplate)
        })
    }
    // 渲染子元素
    function renderChildren(children,template,type){
        template += "<ul>";
        $.each(children, function(i, item){
            template += "<li>" +
                "<div class='title'>" +
                "<i onclick='switchTree(this)' class='el-icon-caret-right icon-calendar"+(item.hasChildren?' icon-plus-sign':'')+"'></i>" +
                "<div class='checkbox-item'>" +
                "<label>" +
                "<input type='checkbox' name='"+type+"checkbox' value="+item.id+" onclick='selectChecbox(this)'/>" +
                "</label>" +
                "</div>" +
                "<span class='name'>"+item.title+"</span>" +
                "</div>";

            if(item.hasChildren){
                template=renderChildren(item.children,template,type)
            }
            template += "</li>";
        })
        template += "</ul>";
        return template
    }
    // 角色所分配的树
    function getRoleTree(roleIds){
        $request({
            url: requestUrl + '/menu/role-tree-keys?roleIds='+roleIds,
            method: 'get',
        }, function(res) {
            var apiScope=res.apiScope;
            var dataScope=res.dataScope;
            var menu=res.menu;
            $.each(apiScope, function(i, item){
                $("input[name='apicheckbox'][value="+item+"]").attr("checked",true);
                $("input[name='apicheckbox'][value="+item+"]").parent().addClass("formrel01-chk__checked");
            })
            $.each(dataScope, function(i, item){
                $("input[name='datacheckbox'][value="+item+"]").attr("checked",true);
                $("input[name='datacheckbox'][value="+item+"]").parent().addClass("formrel01-chk__checked");
            })
            $.each(menu, function(i, item){
                $("input[name='menucheckbox'][value="+item+"]").attr("checked",true);
                $("input[name='menucheckbox'][value="+item+"]").parent().addClass("formrel01-chk__checked");
            })
        })
    }
    // 提交权限设置
    function sumbitPermission(){
        var apiScopeIds=[];
        var dataScopeIds=[];
        var menuIds =[];
        var roleIds=[];
        $("input[name='apicheckbox']:checked").each(function (index, item) {
            apiScopeIds.push($(item).val());
        });
        $("input[name='datacheckbox']:checked").each(function (index, item) {
            dataScopeIds.push($(item).val());
        });
        $("input[name='menucheckbox']:checked").each(function (index, item) {
            menuIds.push($(item).val());
        });
        $("input[name='checkbox']:checked").each(function (index, item) {
            roleIds.push($(item).val());
        });
        var params={
            apiScopeIds: apiScopeIds,
            dataScopeIds: dataScopeIds,
            menuIds: menuIds,
            roleIds: roleIds
        }
        $request({
            url: requestUrl + '/role/grant',
            method: 'post',
            data:JSON.stringify(params),
        },function(e){
            $('#pop-quanxianshezhi').fadeOut("normal");
            $('.pop-bg').removeClass('open');
            getData()
        })
    }
    // 初始化页面请求
    selectgroup();
    getScopeType();

    // 分页页码
    function pageNumInit (num) {
        $('#pageList').children().remove();
        if (currentPage === 1 && currentPage !==num) {
            $('#pageList').append(
                "<li class='pages-prev pages-disable'><a href='javascript:;'><i class='el-icon el-icon-arrow-left'></i></a></li>" +
                getPageNum(num) +
                "<li class='pages-next' onclick='changePageSize(" + currentSize + "," + (currentPage + 1) + ",this)'><a href='javascript:;'><i class='el-icon el-icon-arrow-right'></i></a></li>"
            );
        }
        else if (currentPage === num && currentPage !==1) {
            $('#pageList').append(
                "<li class='pages-prev' onclick='changePageSize(" + currentSize + "," + (currentPage - 1) + ",this)'><a href='javascript:;'><i class='el-icon el-icon-arrow-left'></i></a></li>" +
                getPageNum(num) +
                "<li class='pages-next pages-disable'><a href='javascript:;'><i class='el-icon el-icon-arrow-right'></i></a></li>"
            );
        }else if(currentPage===1&&currentPage===num){
            $('#pageList').append(
                "<li class='pages-prev pages-disable'><a href='javascript:;'><i class='el-icon el-icon-arrow-left'></i></a></li>" +
                getPageNum(num) +
                "<li class='pages-next pages-disable'><a href='javascript:;'><i class='el-icon el-icon-arrow-right'></i></a></li>"
            );
        }else {
            $('#pageList').append(
                "<li class='pages-prev' onclick='changePageSize(" + currentSize + "," + (currentPage - 1) + ",this)'><a href='javascript:;'><i class='el-icon el-icon-arrow-left'></i></a></li>" +
                getPageNum(num) +
                "<li class='pages-next' onclick='changePageSize(" + currentSize + "," + (currentPage + 1) + ", this)'><a href='javascript:;'><i class='el-icon el-icon-arrow-right'></i></a></li>"
            );
        }
    }

    // 分页拼接
    function getPageNum (num) {
        var result = '';
        for (var i = 0; i < num; i++) {
            if (i === 0 && num===1) {
                result += "<li class='pages-active' onclick='changeCurrentPage(1,this)'><a href='javascript:;'>1</a></li>";
            }
            else {
                result += "<li class='"+(currentPage===i+1?'pages-active':'')+"' onclick='changeCurrentPage("+(i+1)+",this)'><a href='javascript:;'>" + (i + 1) + "</a></li>";
            }
        }
        return result;
    }

    // 改变每页条数
    function changePageSize (size, pageNo, current) {
        var page = pageNo ? pageNo : $('#pageNum').val() ? $('#pageNum').val() : 1;
        currentSize = size ? size : 10;
        currentPage = Number(page);
        getData();
        pageNumInit(num);
    }
    // 改变页码
    function changeCurrentPage(pageNo,e){
        $(e).addClass("pages-active").siblings().removeClass('pages-active')
        currentPage = Number(pageNo);
        getData();
    }

    // 手动跳转到某页
    function jumpPage(){
        var pageNo = $('#pageNum').val() ? $('#pageNum').val() : currentPage
        currentPage = Number(pageNo);
        getData();
    }

    // 改变每页条数
    function changeChildPageSize (size, pageNo, current) {
        var page = pageNo ? pageNo : $('#childPageNum').val() ? $('#childPageNum').val() : 1;
        childCurrentSize = size ? size : 10;
        childCcurrentPage = Number(page);
        getChildList();
        childPageNumInit(childNum);
    }
    // 改变页码
    function changeChildCurrentPage(pageNo,e){
        $(e).addClass("pages-active").siblings().removeClass('pages-active')
        childCurrentPage = Number(pageNo)
        getChildList();
    }
    // 手动跳转到某页
    function jumpChildPage(){
        var pageNo = $('#childPageNum').val() ? $('#childPageNum').val() : childCurrentPage
        childCurrentPage = Number(pageNo);
        getChildList();
    }

    function closeModel(){
        $('.pop-bg1').removeClass('open');
    }

    function initEditObj(){
        editObj = {};
    }
</script>
</body>

</html>